<?php
class p_category extends Model
{
    public $id;
	public $path;
	public $parent_id;
	public $forum_id;
	public $title;
	public $title_zh;
	public $title_enid;
	public $path;
	public $parent_id;
	public $forum_id;
	public $title;
	public $title_zh;
	public $title_en;

    public static function getTableName()
    {
        return 'p_category';
    }

    public function set($obj)
    {
        foreach (get_object_vars($this) as $field=>$value) {
            $this->$field = isset($obj->$field) ? $obj->$field : '';
        }
    }

    public function insert($obj)
    {
        return Model::$dbo['w']->save($obj);
    }

    public function update($obj)
    {
        return Model::$dbo['w']->save($obj);
    }

    public function delete($obj)
    {
        return Model::$dbo['w']->deleteInstance($this->getTableName(),$obj->id);
    }
}
?>
